
import Head from 'next/head'

<Head>
  <script>
    {
      `(function() {
         var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?e60fb290e204e04c5cb6f79b0ac1e697";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
       })();`
    }
  </script>
</Head>

![LangChain](https://pica.zhimg.com/50/v2-56e8bbb52aa271012541c1fe1ceb11a2_r.gif)





Aleph Alpha[#](#aleph-alpha "Permalink to this headline")
=========================================================

[The Luminous series](https://docs.aleph-alpha.com/docs/introduction/luminous/)是一系列大型语言模型。
本示例介绍如何使用 LangChain 与 Aleph Alpha 模型进行交互。

```python
# Install the package
!pip install aleph-alpha-client

```

```python
# create a new token: https://docs.aleph-alpha.com/docs/account/#create-a-new-token

from getpass import getpass

ALEPH_ALPHA_API_KEY = getpass()

```

```python
from langchain.llms import AlephAlpha
from langchain import PromptTemplate, LLMChain

```

```python
template = """Q: {question}

A:"""

prompt = PromptTemplate(template=template, input_variables=["question"])

```

```python
llm = AlephAlpha(model="luminous-extended", maximum_tokens=20, stop_sequences=["Q:"], aleph_alpha_api_key=ALEPH_ALPHA_API_KEY)

```

```python
llm_chain = LLMChain(prompt=prompt, llm=llm)

```

```python
question = "What is AI?"

llm_chain.run(question)

```

```python
' Artificial Intelligence (AI) is the simulation of human intelligence processes by machines, especially computer systems.\n'

```

